package com.itheima.sh.user.controller;

import com.itheima.sh.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("my")
public class MyController {

    @GetMapping("me")                                       //添加Request对象
    public Map queryById(HttpServletRequest request) {
        //获取网关gateway添加的请求头信息
        String name = request.getHeader("name");
        System.out.println("网关添加的请求头============================"+name);//hwl

        HashMap<String, String> map = new HashMap<>();
        map.put("HWL","黄文龙");
        return map;
    }
}
